// 对所有的api接口进行统一管理
import requests from './requests'

// 登录接口
export const login = (readerInfo) => requests({
    url: '/login',
    method: 'post',
    data: readerInfo
})
// 注册接口
export const register = (user,username) => requests({
    url: '/register?username=' + username,
    method: 'post',
    data: user
})


// 文章列表接口
export const articleList = () => requests({
    url: '/articleList',
    method:'post'
})

// 文章查看接口
export const articleInfo = (id) => requests({
    url: '/articleInfo?articleId='+ id,
    method:'post',
})



// 点赞接口
export const likeStatusInsert = (likeMessage) => requests({
    url: '/likeStatusInsert',
    method:'post',
    data: likeMessage
})
// 取消点赞接口
export const likeStatusDel = (likeMessage) => requests({
    url: '/likeStatusDel',
    method:'post',
    data: likeMessage
})

// 判断用户是否点赞
export const likeStatusCheck = (likeStatusKey) => requests({
    url: '/likeStatusCheck',
    method:'post',
    data: likeStatusKey
})

// 收藏接口
export const starStatusInsert = (likeMessage) => requests({
    url: '/starStatusInsert',
    method:'post',
    data: likeMessage
})
// 取消收藏接口
export const starStatusDel = (likeMessage) => requests({
    url: '/starStatusDel',
    method:'post',
    data: likeMessage
})
// 判断用户是否收藏
export const starStatusCheck = (starStatusKey) => requests({
    url: '/starStatusCheck',
    method:'post',
    data: starStatusKey
})

// 查看点赞数和收藏数
export const articleStatus = (articleId) => requests({
    url: '/articleStatus?articleId=' + articleId,
    method:'post',
})

// 用户信息接口
export const userInfo = (userId) => requests({
    url: '/userInfo?userId='+ userId,
    method:'post',
})
// 修改用户信息接口
export const userInfoUpdate = (userInfo) => requests({
    url: '/userInfoUpdate',
    method:'post',
    data: userInfo
})
// 修改密码接口
export const userUpdate = (user) => requests({
    url: '/userUpdate',
    method:'post',
    data: user
})
export const articleInsert = (article) => requests({
    url: '/articleInsert',
    method:'post',
    data: article
})



// 搜索文章
export const articleSelect = (article) => requests({
    url: '/articleSelect',
    method:'post',
    data: article
})

// 修改文章
export const articleUpdate = (article) => requests({
    url: '/articleUpdate',
    method:'post',
    data: article
})
// 已点赞的文章
export const likeStatusList = (userId) => requests({
    url: '/likeStatusList?userId='+userId,
    method:'post',
    // data: article
})

// 已收藏的文章
export const starStatusList = (userId) => requests({
    url: '/starStatusList?userId='+userId,
    method:'post',
    // data: article
})

// 发布的文章
export const articleSelectByUser = (userId) => requests({
    url: '/articleSelectByUser?userId='+userId,
    method:'post',
    // data: article
})

// 发表评论
export const commentTopInsert = (comment,articleId) => requests({
    url: '/commentTopInsert?articleId='+ articleId,
    method:'post',
    data:comment
})
// 删除顶级评论
export const commentTopDel = (commentTop,userId) => requests({
    url: '/commentTopDel?userId='+userId,
    method:'post',
    data:commentTop
})
// 展示评论
export const commentList = (articleId) => requests({
    url:'commentList?articleId='+ articleId,
    method:'post',
})

//  返回顶级评论具体的内容
export const commentTopContent = (topCommentId) => requests({
    url: '/commentTopContent?topCommentId='+ topCommentId,
    method:'post',
})

// 回复评论
export const commentReplyInsert = (commentReply,topCommentId) => requests({
    url: '/commentReplyInsert?topCommentId='+ topCommentId,
    method:'post',
    data:commentReply

})
// 删除回复评论
export const commentReplyDel = (commentReply,userId) => requests({
    url: '/commentReplyDel?userId='+userId,
    method:'post',
    data:commentReply
})

// 返回回复评论具体的内容
export const commentReplyContent = (replyCommentId) => requests({
    url: '/commentReplyContent?replyCommentId='+ replyCommentId,
    method:'post',
})

